/**
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */

package org.cspoker.common.elements.table;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;

/**
 * A class to represent a list of tables.
 * 
 */
@XmlAccessorType(XmlAccessType.FIELD)
public class TableList implements Serializable {

	private static final long serialVersionUID = -3605432117019173699L;

	@XmlElementWrapper
	@XmlElement(name = "table")
	private List<Table> tables;

	public TableList(List<Table> tables) {
		if (tables == null) {
			throw new IllegalArgumentException(
					"The given list of tables is not effective.");
		}
		this.tables = tables;
	}

	protected TableList() {
		// no op
	}

	public List<Table> getTables() {
		if (tables == null) {
			tables = new ArrayList<Table>(0);
		}
		return tables;
	}

}
